home *** CD-ROM | disk | FTP | other *** search
/ AppleScript - The Beta Release / AppleScript - The Beta Release.iso / Development Tools / Interfaces / CIncludes / OSA.h < prev    next >
Encoding:
Text File  |  1992-11-02  |  40.4 KB  |  1,054 lines  |  [TEXT/MPS ]

  1. ////////////////////////////////////////////////////////////////////////////////
  2. // OPEN SCRIPTING ARCHITECTURE: Client Interface
  3. ////////////////////////////////////////////////////////////////////////////////
  4. // Copyright © 1992 Apple Computer, Inc. All rights reserved.
  5. // Authors: Jens Alfke, William Cook, Donn Denman, and Warren Harris
  6. ////////////////////////////////////////////////////////////////////////////////
  7. // This interface defines what it means to be a "scripting component."
  8. // Scripting components allow "scripts" to be loaded and executed.  This
  9. // interface does not define the way in which a particular scripting
  10. // component's scripts are editing and debugged.
  11. ////////////////////////////////////////////////////////////////////////////////
  12.  
  13. #ifndef __OSA__
  14. #define __OSA__
  15.  
  16. #ifndef __APPLEEVENTS__
  17. #include <AppleEvents.h>
  18. #endif
  19. #ifndef __COMPONENTS__
  20. #include <Components.h>
  21. #endif
  22.  
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26.  
  27. //////// Conditional Compilation
  28.  
  29. // component implements can define this macro eliminate the inlines
  30. #ifndef OSAComponentFunctionInline
  31. #define OSAComponentFunctionInline(a, b)        = ComponentCallNow(a, b)
  32. #endif 
  33.  
  34. //////// Types and Constants:
  35.  
  36. #define kOSAComponentType                        'osa '
  37.     // The componenent manager type code for components that
  38.     // support the OSA interface defined here.
  39.  
  40. #define kOSAGenericScriptingComponentSubtype    'scpt'
  41.  
  42. typedef ComponentResult                            OSAError;
  43.     // Under the Open Scripting Architecture all error results are longs.
  44.  
  45. typedef unsigned long                            OSAID;
  46.     // OSAIDs allow transparent manipulation of scripts associated with
  47.     // various scripting systems.
  48.  
  49. #define kOSANullScript                            ((OSAID) 0)        
  50.     // No-script constant. 
  51.  
  52. #define kOSANullMode                            0    // sounds better
  53. #define kOSAModeNull                            0    // tastes consistent
  54.     // Some routines take flags that control their execution.  This constant
  55.     // declares default mode settings are used.
  56.  
  57. #define kOSASuite                                'ascr'
  58. #define kOSARecordedText                        'recd'
  59.     // Suite and event code of the RecordedText event. (See OSAStartRecording,
  60.     // below.)
  61.  
  62. //////// Error Codes:
  63.  
  64. #define    errOSACorruptData                    -1702    // Same as errAECorruptData
  65. #define errOSASystemError                    -1750
  66. #define    errOSAInvalidID                        -1751
  67. #define errOSABadStorageType                -1752
  68. #define errOSAScriptError                    -1753
  69. #define errOSABadSelector                    -1754
  70. #define errOSAInvalidAccess                    -1755
  71. #define errOSASourceNotAvailable            -1756
  72. #define errOSARecordingIsAlreadyOn            -1732    // Same as errAERecordingIsAlreadyOn
  73.  
  74. ////////////////////////////////////////////////////////////////////////////////
  75. // OSA Interface Descriptions
  76. ////////////////////////////////////////////////////////////////////////////////
  77. // The OSA Interface is broken down into a required interface, and several
  78. // optional interfaces to support additional functionality.  A given scripting
  79. // component may choose to support only some of the optional interfaces in
  80. // addition to the basic interface.  The OSA Component Flags may be used to 
  81. // query the Component Manager to find a scripting component with a particular
  82. // capability, or determine if a particular scripting component supports a 
  83. // particular capability.
  84. ////////////////////////////////////////////////////////////////////////////////
  85.  
  86. //////// OSA Component Flags:
  87.  
  88. #define kOSASupportsCompiling                (1 << 1)
  89. #define kOSASupportsGetSource                (1 << 2)
  90. #define kOSASupportsAECoercion                (1 << 3)
  91. #define kOSASupportsAESending                (1 << 4)
  92. #define kOSASupportsRecording                (1 << 5)
  93. #define kOSASupportsConvenience                (1 << 6)
  94. #define kOSASupportsDialects                (1 << 7)
  95. #define kOSASupportsEventHandling            (1 << 8)
  96.  
  97. //////// Component Selectors:
  98.  
  99. // Basic Scripting:
  100. #define    kOSASelectLoad                        0x0001
  101. #define    kOSASelectStore                        0x0002
  102. #define    kOSASelectExecute                    0x0003
  103. #define    kOSASelectDisplay                    0x0004
  104. #define    kOSASelectScriptError                0x0005
  105. #define    kOSASelectDispose                    0x0006
  106. #define    kOSASelectSetScriptInfo                0x0007
  107. #define    kOSASelectGetScriptInfo                0x0008
  108. #define    kOSASelectSetActiveProc                0x0009
  109. #define    kOSASelectGetActiveProc                0x000A
  110. // Compiling:
  111. #define    kOSASelectScriptingComponentName    0x0102
  112. #define    kOSASelectCompile                    0x0103
  113. #define    kOSASelectCopyID                    0x0104
  114. // GetSource:
  115. #define    kOSASelectGetSource                    0x0201
  116. // AECoercion:
  117. #define    kOSASelectCoerceFromDesc            0x0301
  118. #define kOSASelectCoerceToDesc                0x0302
  119. // AESending:
  120. #define    kOSASelectSetSendProc                0x0401
  121. #define    kOSASelectGetSendProc                0x0402
  122. #define    kOSASelectSetCreateProc                0x0403
  123. #define    kOSASelectGetCreateProc                0x0404
  124. #define kOSASelectSetDefaultTarget            0x0405
  125. // Recording:
  126. #define    kOSASelectStartRecording            0x0501
  127. #define    kOSASelectStopRecording                0x0502
  128. // Convenience:
  129. #define    kOSASelectLoadExecute                0x0601
  130. #define    kOSASelectCompileExecute            0x0602
  131. #define    kOSASelectDoScript                    0x0603
  132. // Dialects:
  133. #define kOSASelectSetCurrentDialect            0x0701
  134. #define kOSASelectGetCurrentDialect            0x0702
  135. #define kOSASelectAvailableDialects            0x0703
  136. // Event Handling:
  137. #define    kOSASelectSetResumeDispatchProc        0x0801
  138. #define    kOSASelectGetResumeDispatchProc        0x0802
  139. #define    kOSASelectExecuteEvent                0x0803
  140. #define    kOSASelectDoEvent                    0x0804
  141. #define    kOSASelectMakeContext                0x0805
  142.  
  143. #define    kOSASelectComponentSpecificStart    0x1001
  144.     // scripting component specific selectors are added beginning with this
  145.     // value
  146.  
  147. //////// Mode Flags:
  148. //
  149. // Warning: These should not conflict with the AESend mode flags in
  150. // AppleEvents.h, because we may want to use them as OSA mode flags too.
  151.  
  152. #define kOSAModePreventGetSource            0x00000001
  153.     // This mode flag may be passed to OSALoad, OSAStore or OSACompile to
  154.     // instruct the scripting component to not retain the "source" of an
  155.     // expression.  This will cause the OSAGetSource call to return the error
  156.     // errOSASourceNotAvailable if used.  However, some scripting components
  157.     // may not retain the source anyway.  This is mainly used when either space
  158.     // efficiency is desired, or a script is to be "locked" so that its
  159.     // implementation may not be viewed.
  160.  
  161. #define kOSAModeNeverInteract                kAENeverInteract
  162. #define kOSAModeCanInteract                    kAECanInteract
  163. #define kOSAModeAlwaysInteract                kAEAlwaysInteract
  164. #define kOSAModeDontReconnect                kAEDontReconnect
  165.     // These mode flags may be passed to OSACompile, OSAExecute, OSALoadExecute
  166.     // OSACompileExecute, OSADoScript, OSAExecuteEvent, or OSADoEvent to
  167.     // indicate whether or not the script may interact with the user, switch
  168.     // layer or reconnect if necessary.  Any AppleEvents will be sent with the
  169.     // corresponding AESend mode supplied.
  170.  
  171. #define kOSAModeCantSwitchLayer                0x00000040
  172.     // This mode flag may be passed to OSACompile, OSAExecute, OSALoadExecute
  173.     // OSACompileExecute, OSADoScript, OSAExecuteEvent, or OSADoEvent to
  174.     // indicate whether or not AppleEvents should be sent with the
  175.     // kAECanSwitchLayer mode flag sent or not. NOTE: This flag is exactly the
  176.     // opposite sense of the AppleEvent flag kAECanSwitchLayer.  This is to
  177.     // provide a more convenient default, i.e. not supplying any mode
  178.     // (kOSAModeNull) means to send events with kAECanSwitchLayer.  Supplying
  179.     // the kOSAModeCantSwitchLayer mode flag will cause AESend to be called
  180.     // without kAECanSwitchLayer.
  181.  
  182. #define kOSAModeDoRecord                    0x00001000
  183.     // This mode flag may be passed to OSACompile, OSAExecute, OSALoadExecute
  184.     // OSACompileExecute, OSADoScript, OSAExecuteEvent, or OSADoEvent to
  185.     // indicate whether or not AppleEvents should be sent with the kAEDontRecord
  186.     // mode flag sent or not. NOTE: This flag is exactly the opposite sense of
  187.     // the AppleEvent flag kAEDontRecord.  This is to provide a more convenient
  188.     // default, i.e. not supplying any mode (kOSAModeNull) means to send events
  189.     // with kAEDontRecord.  Supplying the kOSAModeDoRecord mode flag will 
  190.     // cause AESend to be called without kAEDontRecord.
  191.  
  192. #define kOSAModeCompileIntoContext            0x00000002
  193.     // This is a mode flag for OSACompile that indicates that a context should
  194.     // be created as the result of compilation. All handler definitions are
  195.     // inserted into the new context, and variables are initialized by
  196.     // evaluating their initial values in a null context (i.e. they must be
  197.     // constant expressions).
  198.  
  199. #define kOSAModeAugmentContext                0x00000004
  200.     // This is a mode flag for OSACompile that indicates that the previous
  201.     // script ID (input to OSACompile) should be augmented with any new
  202.     // definitions in the sourceData rather than replaced with a new script.
  203.     // This means that the previous script ID must designate a context.
  204.     // The presence of this flag causes the kOSAModeCompileIntoContext flag
  205.     // to be implicitly used, causing any new definitions to be initialized
  206.     // in a null context.
  207.  
  208. #define kOSAModeDisplayForHumans            0x00000008
  209.     // This mode flag may be passed to OSADisplay or OSADoScript to indicate
  210.     // that output only need be human-readable, not re-compilable by OSACompile.
  211.     // If used, output may be arbitrarily "beautified", e.g. quotes may be left
  212.     // off of string values, long lists may have elipses, etc.
  213.  
  214. ////////////////////////////////////////////////////////////////////////////////
  215. // OSA Basic Scripting Interface
  216. ////////////////////////////////////////////////////////////////////////////////
  217. // Scripting components must at least support the Basic Scripting interface.
  218. ////////////////////////////////////////////////////////////////////////////////
  219.  
  220. //////// Loading and Storing Scripts:
  221. //
  222. // These routines allow scripts to be loaded and stored in their internal
  223. // (possibly compiled, non-text) representation.
  224.  
  225. #define kOSAScriptResourceType                kOSAGenericScriptingComponentSubtype
  226.     // Resource type for scripts.
  227.     
  228. #define typeOSAGenericStorage                kOSAScriptResourceType
  229.     // Default type given to OSAStore which creates "generic" loadable script
  230.     // data descriptors.
  231.  
  232. pascal OSAError
  233. OSALoad(ComponentInstance        scriptingComponent,
  234.         const AEDesc*            scriptData,
  235.         long                    modeFlags,
  236.         OSAID*                    resultingCompiledScriptID)
  237.     OSAComponentFunctionInline(kOSASelectLoad, 12);
  238.     //
  239.     // Errors:
  240.     //    badComponentInstance    invalid scripting component instance
  241.     //     errOSASystemError
  242.     //     errOSABadStorageType:    scriptData not for this scripting component
  243.     //     errOSACorruptData:        data seems to be corrupt
  244.     // 
  245.     // ModeFlags:
  246.     //    kOSAModePreventGetSource
  247.  
  248. pascal OSAError
  249. OSAStore(ComponentInstance        scriptingComponent, 
  250.          OSAID                    compiledScriptID, 
  251.          DescType                desiredType,
  252.          long                    modeFlags,
  253.          AEDesc*                resultingScriptData)
  254.     OSAComponentFunctionInline(kOSASelectStore, 16);
  255.     //
  256.     // Errors:
  257.     //    badComponentInstance    invalid scripting component instance
  258.     //     errOSASystemError
  259.     //     errOSAInvalidID
  260.     //     errOSABadStorageType:    desiredType not for this scripting component
  261.     // 
  262.     // ModeFlags:
  263.     //    kOSAModePreventGetSource
  264.  
  265. //////// Executing Scripts:
  266.  
  267. pascal OSAError
  268. OSAExecute(ComponentInstance    scriptingComponent,
  269.            OSAID                compiledScriptID,
  270.            OSAID                contextID,
  271.            long                    modeFlags,
  272.            OSAID*                resultingScriptValueID)
  273.     OSAComponentFunctionInline(kOSASelectExecute, 16);
  274.     // This call runs a script.  The contextID represents the environment
  275.     // with which global variables in the script are resolved.  The constant
  276.     // kOSANullScript may be used for the contextID if the application wishes
  277.     // to not deal with context directly (a default one is associated with each
  278.     // scripting component instance).  The resultingScriptValueID is the 
  279.     // result of evaluation, and contains a value which may be displayed using
  280.     // the OSAGetSource call.  The modeFlags convey scripting component
  281.     // specific information.
  282.     //
  283.     // Errors:
  284.     //    badComponentInstance    invalid scripting component instance
  285.     //     errOSASystemError
  286.     //     errOSAInvalidID
  287.     //     errOSAInvalidAccess:    can't modify contextID
  288.     //     errOSAScriptError:        the executing script got an error
  289.     //
  290.     // ModeFlags:
  291.     //    kOSAModeNeverInteract
  292.     //    kOSAModeCanInteract
  293.     //    kOSAModeAlwaysInteract
  294.     //    kOSAModeCantSwitchLayer
  295.     //    kOSAModeDontReconnect
  296.     //    kOSAModeDoRecord
  297.  
  298. //////// Displaying results:
  299.  
  300. pascal OSAError
  301. OSADisplay(ComponentInstance    scriptingComponent,
  302.            OSAID                scriptValueID,
  303.            DescType                desiredType,
  304.            long                    modeFlags,
  305.            AEDesc*                resultingText)
  306.     OSAComponentFunctionInline(kOSASelectDisplay, 16);
  307.     // This call is used to convert results (script value IDs) into displayable
  308.     // text. The desiredType should be at least typeChar, and modeFlags are
  309.     // scripting system specific flags to control the formatting of the
  310.     // resulting text. This call differs from OSAGetSource in that (1) it
  311.     // always produces at least typeChar, (2) is only works on script values,
  312.     // (3) it may display it's output in non-compilable form (e.g. without
  313.     // string quotes, elipses inserted in long and/or circular lists, etc.) and
  314.     // (4) it is required by the basic scripting interface.
  315.     //
  316.     // Errors:
  317.     //    badComponentInstance    invalid scripting component instance
  318.     //     errOSASystemError
  319.     //     errOSAInvalidID
  320.     //     errAECoercionFail:        desiredType not supported by scripting component
  321.     //
  322.     // ModeFlags:
  323.     //    kOSAModeDisplayForHumans
  324.  
  325. //////// Getting Error Information:
  326.  
  327. pascal OSAError
  328. OSAScriptError(ComponentInstance    scriptingComponent,
  329.                OSType                selector,
  330.                DescType                desiredType,
  331.                AEDesc*                resultingErrorDescription)
  332.     OSAComponentFunctionInline(kOSASelectScriptError, 12);
  333.     // Whenever script execution returns errOSAExecutionError, this routine
  334.     // may be used to get information about that error.  The selector describes
  335.     // the type of information desired about the error (various selectors are
  336.     // listed below).  The desiredType indicates the data type of the result
  337.     // desired for that selector.
  338.     //
  339.     // Errors:
  340.     //    badComponentInstance    invalid scripting component instance
  341.     //     errOSASystemError
  342.     //    errOSABadSelector:        selector not supported by scripting component
  343.     //     errAECoercionFail:        desiredType not supported by scripting component
  344.  
  345. // OSAScriptError selectors:
  346.  
  347. #define kOSAErrorNumber                        'errn'
  348.     // This selector is used to determine the error number of a script error.
  349.     // These error numbers may be either system error numbers, or error numbers
  350.     // that are scripting component specific.
  351.     // Required desiredTypes:
  352.     //    typeShortInteger
  353.  
  354. #define kOSAErrorMessage                    'errs'
  355.     // This selector is used to determine the full error message associated
  356.     // with the error number.  It should include the name of the application
  357.     // which caused the error, as well as the specific error that occurred.
  358.     // This selector is sufficient for simple error reporting (but see
  359.     // kOSAErrorBriefMessage, below).
  360.     // Required desiredTypes:
  361.     //    typeChar                    error message string
  362.  
  363. #define kOSAErrorBriefMessage                'errb'
  364.     // This selector is used to determine a brief error message associated with
  365.     // the error number.  This message and should not mention the name of the
  366.     // application which caused the error, any partial results or offending
  367.     // object (see kOSAErrorApp, kOSAErrorPartialResult and
  368.     // kOSAErrorOffendingObject, below).
  369.     // Required desiredTypes:
  370.     //    typeChar                    brief error message string
  371.  
  372. #define kOSAErrorApp                        'erap'
  373.     // This selector is used to determine which application actually got the
  374.     // error (if it was the result of an AESend), or the current application
  375.     // if ....
  376.     // Required desiredTypes:
  377.     //    typeProcessSerialNumber        PSN of the errant application
  378.     //    typeChar                    name of the errant application
  379.  
  380. #define kOSAErrorPartialResult                'ptlr'
  381.     // This selector is used to determine any partial result returned by an 
  382.     // operation. If an AESend call failed, but a partial result was returned,
  383.     // then the partial result may be returned as an AEDesc.
  384.     // Required desiredTypes:
  385.     //    typeBest                    AEDesc of any partial result
  386.  
  387. #define kOSAErrorOffendingObject            'erob'
  388.     // This selector is used to determine any object which caused the error
  389.     // that may have been indicated by an application.  The result is an 
  390.     // AEDesc.
  391.     // Required desiredTypes:
  392.     //    typeBest                    AEDesc of any offending object
  393.     
  394. #define kOSAErrorRange                        'erng'
  395.     // This selector is used to determine the source text range (start and 
  396.     // end positions) of where the error occurred.
  397.     // Required desiredTypes:
  398.     //    typeOSAErrorRange
  399.  
  400. #define typeOSAErrorRange                    'erng'
  401.     // An AERecord type containing keyOSASourceStart and keyOSASourceEnd fields
  402.     // of type short.
  403. #define keyOSASourceStart                    'srcs'
  404.     // Field of a typeOSAErrorRange record of typeShortInteger.
  405. #define keyOSASourceEnd                        'srce'
  406.     // Field of a typeOSAErrorRange record of typeShortInteger.
  407.  
  408. //////// Disposing Script IDs:
  409.  
  410. pascal OSAError
  411. OSADispose(ComponentInstance    scriptingComponent,
  412.            OSAID                scriptID)
  413.     OSAComponentFunctionInline(kOSASelectDispose, 4);
  414.     // Disposes a script or context.
  415.     //
  416.     // Errors:
  417.     //    badComponentInstance    invalid scripting component instance
  418.     //     errOSASystemError
  419.     //     errOSAInvalidID
  420.  
  421. //////// Getting and Setting Script Information:
  422.  
  423. pascal OSAError
  424. OSASetScriptInfo(ComponentInstance        scriptingComponent,
  425.                  OSAID                    scriptID,
  426.                  OSType                    selector,
  427.                  long                    value)
  428.     OSAComponentFunctionInline(kOSASelectSetScriptInfo, 12);
  429.     //
  430.     // Errors:
  431.     //    badComponentInstance    invalid scripting component instance
  432.     //     errOSASystemError
  433.     //     errOSAInvalidID
  434.     //    errOSABadSelector:        selector not supported by scripting component
  435.     //     errOSAInvalidAccess:    selector not for this scriptID
  436.  
  437. pascal OSAError
  438. OSAGetScriptInfo(ComponentInstance        scriptingComponent,
  439.                  OSAID                    scriptID,
  440.                  OSType                    selector,
  441.                  long*                    result)
  442.     OSAComponentFunctionInline(kOSASelectGetScriptInfo, 12);
  443.     //
  444.     // Errors:
  445.     //    badComponentInstance    invalid scripting component instance
  446.     //     errOSASystemError
  447.     //     errOSAInvalidID
  448.     //    errOSABadSelector:        selector not supported by scripting component
  449.     //     errOSAInvalidAccess:    selector not for this scriptID
  450.  
  451. #define kOSAScriptIsModified            'modi'
  452.     // Selector returns boolean.
  453.  
  454. #define kOSAScriptIsBeingEdited            'edit'
  455.     // Selector returns boolean.
  456.  
  457. #define kOSAScriptIsBeingRecorded        'recd'
  458.     // Selector returns boolean.
  459.  
  460. #define kOSAScriptIsTypeCompiledScript    'cscr'
  461.     // Selector returns boolean.
  462.     
  463. #define kOSAScriptIsTypeScriptValue        'valu'
  464.     // Selector returns boolean.
  465.  
  466. #define kOSAScriptIsTypeScriptContext    'cntx'
  467.     // Selector returns boolean.
  468.  
  469. #define kOSAScriptBestType                'best'
  470.     // Selector returns a DescType which may be passed to OSACoerceToDesc.
  471.  
  472. //////// Manipulating the ActiveProc:
  473. //
  474. // Scripting systems will supply default values for these procedures if they
  475. // are not set by the client:
  476.  
  477. typedef pascal OSErr (*OSAActiveProcPtr)(long refCon);
  478.  
  479. pascal OSAError
  480. OSASetActiveProc(ComponentInstance        scriptingComponent,
  481.                  OSAActiveProcPtr        activeProc,
  482.                  long                    refCon)
  483.     OSAComponentFunctionInline(kOSASelectSetActiveProc, 8);
  484.     // If activeProc is nil, the default activeProc is used.
  485.     //
  486.     // Errors:
  487.     //    badComponentInstance    invalid scripting component instance
  488.     //     errOSASystemError
  489.  
  490. pascal OSAError
  491. OSAGetActiveProc(ComponentInstance        scriptingComponent,
  492.                  OSAActiveProcPtr*        activeProc,
  493.                  long*                    refCon)
  494.     OSAComponentFunctionInline(kOSASelectGetActiveProc, 8);
  495.     //
  496.     // Errors:
  497.     //    badComponentInstance    invalid scripting component instance
  498.     //     errOSASystemError
  499.  
  500. ////////////////////////////////////////////////////////////////////////////////
  501. // OSA Optional Compiling Interface
  502. ////////////////////////////////////////////////////////////////////////////////
  503. // Scripting components that support the Compiling interface have the 
  504. // kOSASupportsCompiling bit set in it's ComponentDescription.
  505. ////////////////////////////////////////////////////////////////////////////////
  506.  
  507. pascal OSAError
  508. OSAScriptingComponentName(ComponentInstance    scriptingComponent,
  509.                           AEDesc*            resultingScriptingComponentName)
  510.     OSAComponentFunctionInline(kOSASelectScriptingComponentName, 4);
  511.     // Given a scripting component, this routine returns the name of that
  512.     // scripting component in a type that is coercable to text (typeChar).
  513.     // The generic scripting component returns the name of the default
  514.     // scripting component.  This name should be sufficient to convey to the
  515.     // user the kind of script (syntax) he is expected to write.
  516.     //
  517.     // Errors:
  518.     //    badComponentInstance    invalid scripting component instance
  519.     //     errOSASystemError
  520.  
  521. pascal OSAError
  522. OSACompile(ComponentInstance    scriptingComponent,
  523.            const AEDesc*        sourceData,
  524.            long                    modeFlags,
  525.            OSAID*                previousAndResultingCompiledScriptID)
  526.     OSAComponentFunctionInline(kOSASelectCompile, 12);
  527.     // Coerces input desc (possibly text) into a script's internal format.
  528.     // Once compiled, the script is ready to run.  The modeFlags convey
  529.     // scripting component specific information.  The previous script ID
  530.     // (result parameter) is made to refer to the newly compiled script,
  531.     // unless it was originally kOSANullScript.  In this case a new script
  532.     // ID is created and used.
  533.     //
  534.     // Errors:
  535.     //    badComponentInstance    invalid scripting component instance
  536.     //     errOSASystemError
  537.     //    errAECoercionFail:        sourceData is not compilable
  538.     //     errOSAScriptError:        sourceData was a bad script (syntax error)
  539.     //     errOSAInvalidID:        previousAndResultingCompiledScriptID was not
  540.     //                            valid on input
  541.     //
  542.     // ModeFlags:
  543.     //    kOSAModePreventGetSource
  544.     //    kOSAModeCompileIntoContext
  545.     //    kOSAModeAugmentContext
  546.     //    kOSAModeNeverInteract
  547.     //    kOSAModeCanInteract
  548.     //    kOSAModeAlwaysInteract
  549.     //    kOSAModeCantSwitchLayer
  550.     //    kOSAModeDontReconnect
  551.     //    kOSAModeDoRecord
  552.  
  553. pascal OSAError
  554. OSACopyID(ComponentInstance        scriptingComponent,
  555.           OSAID                    fromID,
  556.           OSAID*                toID)
  557.     OSAComponentFunctionInline(kOSASelectCopyID, 8);
  558.     // If toID is a reference to kOSANullScript then it is updated to have a
  559.     // new scriptID value.  This call can be used to perform undo or revert
  560.     // operations on scripts. 
  561.     //
  562.     // Errors:
  563.     //    badComponentInstance    invalid scripting component instance
  564.     //     errOSASystemError
  565.     //     errOSAInvalidID
  566.  
  567. ////////////////////////////////////////////////////////////////////////////////
  568. // OSA Optional GetSource Interface
  569. ////////////////////////////////////////////////////////////////////////////////
  570. // Scripting components that support the GetSource interface have the 
  571. // kOSASupportsGetSource bit set in it's ComponentDescription.
  572. ////////////////////////////////////////////////////////////////////////////////
  573.  
  574. pascal OSAError
  575. OSAGetSource(ComponentInstance        scriptingComponent,
  576.              OSAID                    scriptID,
  577.              DescType                desiredType,
  578.              AEDesc*                resultingSourceData)
  579.     OSAComponentFunctionInline(kOSASelectGetSource, 12);
  580.     // This routine causes a compiled script to be output in a form (possibly
  581.     // text) such that it is suitable to be passed back to OSACompile.
  582.     //
  583.     // Errors:
  584.     //    badComponentInstance    invalid scripting component instance
  585.     //     errOSASystemError
  586.     //     errOSAInvalidID
  587.     //     errOSAInvalidAccess:    can't get source for this scriptID
  588.     //    errOSASourceNotAvailable
  589.  
  590. ////////////////////////////////////////////////////////////////////////////////
  591. // OSA Optional AECoercion Interface
  592. ////////////////////////////////////////////////////////////////////////////////
  593. // Scripting components that support the AECoercion interface have the 
  594. // kOSASupportsAECoercion bit set in it's ComponentDescription.
  595. ////////////////////////////////////////////////////////////////////////////////
  596.  
  597. pascal OSAError
  598. OSACoerceFromDesc(ComponentInstance        scriptingComponent,
  599.                   const AEDesc*            scriptData,
  600.                   long                    modeFlags,
  601.                   OSAID*                resultingScriptID)
  602.     OSAComponentFunctionInline(kOSASelectCoerceFromDesc, 12);
  603.     // This routine causes script data to be coerced into a script value.
  604.     // If the scriptData is an AppleEvent, then the resultingScriptID is a
  605.     // compiled script ID (mode flags for OSACompile may be used in this case).
  606.     // Other scriptData descriptors create script value IDs.
  607.     //
  608.     // Errors:
  609.     //    badComponentInstance    invalid scripting component instance
  610.     //     errOSASystemError
  611.     //
  612.     // ModeFlags:
  613.     //    kOSAModePreventGetSource
  614.     //    kOSAModeCompileIntoContext
  615.     //    kOSAModeNeverInteract
  616.     //    kOSAModeCanInteract
  617.     //    kOSAModeAlwaysInteract
  618.     //    kOSAModeCantSwitchLayer
  619.     //    kOSAModeDontReconnect
  620.     //    kOSAModeDoRecord
  621.  
  622. pascal OSAError
  623. OSACoerceToDesc(ComponentInstance        scriptingComponent,
  624.                 OSAID                    scriptID,
  625.                 DescType                desiredType,
  626.                 long                    modeFlags,
  627.                 AEDesc*                    result)
  628.     OSAComponentFunctionInline(kOSASelectCoerceToDesc, 16);
  629.     // This routine causes a script value to be coerced into any desired form.
  630.     // If the scriptID denotes a compiled script, then it may be coerced to 
  631.     // typeAppleEvent.
  632.     //
  633.     // Errors:
  634.     //    badComponentInstance    invalid scripting component instance
  635.     //     errOSASystemError
  636.     //     errOSAInvalidID
  637.  
  638. ////////////////////////////////////////////////////////////////////////////////
  639. // OSA Optional AESending Interface
  640. ////////////////////////////////////////////////////////////////////////////////
  641. // Scripting components that support the AESending interface have the 
  642. // kOSASupportsAESending bit set in it's ComponentDescription.
  643. ////////////////////////////////////////////////////////////////////////////////
  644.  
  645. // Scripting systems will supply default values for these procedures if they
  646. // are not set by the client:
  647.  
  648. typedef pascal OSErr (*AESendProcPtr)(const AppleEvent*        theAppleEvent,
  649.                                       AppleEvent*            reply,
  650.                                       AESendMode             sendMode,
  651.                                       AESendPriority         sendPriority,
  652.                                       long                     timeOutInTicks,
  653.                                       IdleProcPtr            idleProc,
  654.                                       EventFilterProcPtr    filterProc,
  655.                                       long                     refCon);
  656.  
  657. pascal OSAError
  658. OSASetSendProc(ComponentInstance    scriptingComponent,
  659.                AESendProcPtr        sendProc,
  660.                long                    refCon)
  661.     OSAComponentFunctionInline(kOSASelectSetSendProc, 8);
  662.     // If sendProc is nil, the default sendProc is used.
  663.     //
  664.     // Errors:
  665.     //    badComponentInstance    invalid scripting component instance
  666.     //     errOSASystemError
  667.  
  668. pascal OSAError
  669. OSAGetSendProc(ComponentInstance    scriptingComponent,
  670.                AESendProcPtr*        sendProc,
  671.                long*                refCon)
  672.     OSAComponentFunctionInline(kOSASelectGetSendProc, 8);
  673.     //
  674.     // Errors:
  675.     //    badComponentInstance    invalid scripting component instance
  676.     //     errOSASystemError
  677.  
  678. typedef pascal OSErr (*AECreateAppleEventProcPtr)(
  679.                         AEEventClass             theAEEventClass,
  680.                         AEEventID                 theAEEventID,
  681.                         const AEAddressDesc*    target,
  682.                         short                     returnID,
  683.                         long                     transactionID,
  684.                         AppleEvent*                result,
  685.                         long                     refCon);
  686.  
  687. pascal OSAError
  688. OSASetCreateProc(ComponentInstance            scriptingComponent,
  689.                  AECreateAppleEventProcPtr    createProc,
  690.                  long                        refCon)
  691.     OSAComponentFunctionInline(kOSASelectSetCreateProc, 8);
  692.     // If createProc is nil, the default createProc is used.
  693.     //
  694.     // Errors:
  695.     //    badComponentInstance    invalid scripting component instance
  696.     //     errOSASystemError
  697.  
  698. pascal OSAError
  699. OSAGetCreateProc(ComponentInstance            scriptingComponent,
  700.                  AECreateAppleEventProcPtr*    createProc,
  701.                  long*                        refCon)
  702.     OSAComponentFunctionInline(kOSASelectGetCreateProc, 8);
  703.     //
  704.     // Errors:
  705.     //    badComponentInstance    invalid scripting component instance
  706.     //     errOSASystemError
  707.  
  708. pascal OSAError
  709. OSASetDefaultTarget(ComponentInstance        scriptingComponent,
  710.                      const AEAddressDesc*    target)
  711.     OSAComponentFunctionInline(kOSASelectSetDefaultTarget, 4);
  712.     // This routine sets the default target application for AE sending.
  713.     // It also establishes the default target from which terminologies come.
  714.     // It is effectively like having an AppleScript "tell" statement around
  715.     // the entire program.  If this routine is not called, or if the target 
  716.     // is a null AEDesc, then the current application is the default target.
  717.     //
  718.     // Errors:
  719.     //    badComponentInstance    invalid scripting component instance
  720.     //     errOSASystemError
  721.  
  722. ////////////////////////////////////////////////////////////////////////////////
  723. // OSA Optional Recording Interface
  724. ////////////////////////////////////////////////////////////////////////////////
  725. // Scripting components that support the Recording interface have the 
  726. // kOSASupportsRecording bit set in it's ComponentDescription.
  727. ////////////////////////////////////////////////////////////////////////////////
  728.  
  729. pascal OSAError
  730. OSAStartRecording(ComponentInstance        scriptingComponent,
  731.                   OSAID*                compiledScriptToModifyID)
  732.     OSAComponentFunctionInline(kOSASelectStartRecording, 4);
  733.     // Starts recording.  If compiledScriptToModifyID is kOSANullScript, a
  734.     // new script ID is created and returned.  If the current application has
  735.     // a handler for the kOSARecordedText event, then kOSARecordedText events
  736.     // are sent to the application containing the text of each AppleEvent 
  737.     // recorded.
  738.     //
  739.     // Errors:
  740.     //    badComponentInstance    invalid scripting component instance
  741.     //     errOSASystemError
  742.     //     errOSAInvalidID
  743.     //     errOSAInvalidAccess:    can't record into compiledScriptToModifyID
  744.  
  745. pascal OSAError
  746. OSAStopRecording(ComponentInstance    scriptingComponent,
  747.                  OSAID                compiledScriptID)
  748.     OSAComponentFunctionInline(kOSASelectStopRecording, 4);
  749.     // If compiledScriptID is not being recorded into or recording is not
  750.     // currently on, no error is returned.
  751.     //
  752.     // Errors:
  753.     //    badComponentInstance    invalid scripting component instance
  754.     //     errOSASystemError
  755.     //     errOSAInvalidID
  756.  
  757. ////////////////////////////////////////////////////////////////////////////////
  758. // OSA Optional Convenience Interface
  759. ////////////////////////////////////////////////////////////////////////////////
  760. // Scripting components that support the Convenience interface have the 
  761. // kOSASupportsConvenience bit set in it's ComponentDescription.
  762. ////////////////////////////////////////////////////////////////////////////////
  763.  
  764. pascal OSAError 
  765. OSALoadExecute(ComponentInstance    scriptingComponent,
  766.                const AEDesc*        scriptData,
  767.                OSAID                contextID,
  768.                long                    modeFlags,
  769.                OSAID*                resultingScriptValueID)
  770.     OSAComponentFunctionInline(kOSASelectLoadExecute, 16);
  771.     // This routine is effectively equivalent to calling OSALoad followed by
  772.     // OSAExecute.  After execution, the compiled source is disposed.  Only the
  773.     // resulting value ID is retained.
  774.     //
  775.     // Errors:
  776.     //    badComponentInstance    invalid scripting component instance
  777.     //     errOSASystemError
  778.     //     errOSABadStorageType:    scriptData not for this scripting component
  779.     //     errOSACorruptData:        data seems to be corrupt
  780.     //     errOSAInvalidID
  781.     //     errOSAInvalidAccess:    can't modify contextID
  782.     //     errOSAScriptError:        the executing script got an error
  783.     //
  784.     // ModeFlags:
  785.     //    kOSAModeNeverInteract
  786.     //    kOSAModeCanInteract
  787.     //    kOSAModeAlwaysInteract
  788.     //    kOSAModeCantSwitchLayer
  789.     //    kOSAModeDontReconnect
  790.     //    kOSAModeDoRecord
  791.  
  792. pascal OSAError 
  793. OSACompileExecute(ComponentInstance    scriptingComponent,
  794.                   const AEDesc*        sourceData,
  795.                   OSAID                contextID,
  796.                   long                modeFlags,
  797.                   OSAID*            resultingScriptValueID)
  798.     OSAComponentFunctionInline(kOSASelectCompileExecute, 16);
  799.     // This routine is effectively equivalent to calling OSACompile followed by
  800.     // OSAExecute.  After execution, the compiled source is disposed.  Only the
  801.     // resulting value ID is retained.
  802.     //
  803.     // Errors:
  804.     //    badComponentInstance    invalid scripting component instance
  805.     //     errOSASystemError
  806.     //    errAECoercionFail:        sourceData is not compilable
  807.     //     errOSAScriptError:        sourceData was a bad script (syntax error)
  808.     //     errOSAInvalidID:        previousAndResultingCompiledScriptID was not
  809.     //                            valid on input
  810.     //     errOSAInvalidAccess:    can't modify contextID
  811.     //     errOSAScriptError:        the executing script got an error
  812.     //
  813.     // ModeFlags:
  814.     //    kOSAModeNeverInteract
  815.     //    kOSAModeCanInteract
  816.     //    kOSAModeAlwaysInteract
  817.     //    kOSAModeCantSwitchLayer
  818.     //    kOSAModeDontReconnect
  819.     //    kOSAModeDoRecord
  820.  
  821. pascal OSAError 
  822. OSADoScript(ComponentInstance    scriptingComponent,
  823.             const AEDesc*        sourceData,
  824.             OSAID                contextID,
  825.             DescType            desiredType,
  826.             long                modeFlags,
  827.             AEDesc*                resultingText)
  828.     OSAComponentFunctionInline(kOSASelectDoScript, 20);
  829.     // This routine is effectively equivalent to calling OSACompile followed by
  830.     // OSAExecute and then OSADisplay.  After execution, the compiled source
  831.     // and the resulting value are is disposed.  Only the resultingText
  832.     // descriptor is retained.  If a script error occur during processing, the 
  833.     // resultingText gets the error message of the error, and errOSAScriptError
  834.     // is returned.  OSAScriptError may still be used to extract more 
  835.     // information about the particular error.
  836.     //
  837.     // Errors:
  838.     //    badComponentInstance    invalid scripting component instance
  839.     //     errOSASystemError
  840.     //    errAECoercionFail:        sourceData is not compilable or 
  841.     //                            desiredType not supported by scripting component
  842.     //     errOSAScriptError:        sourceData was a bad script (syntax error)
  843.     //     errOSAInvalidID:        previousAndResultingCompiledScriptID was not
  844.     //                            valid on input
  845.     //     errOSAInvalidAccess:    can't modify contextID
  846.     //     errOSAScriptError:        the executing script got an error
  847.     //
  848.     // ModeFlags:
  849.     //    kOSAModeNeverInteract
  850.     //    kOSAModeCanInteract
  851.     //    kOSAModeAlwaysInteract
  852.     //    kOSAModeCantSwitchLayer
  853.     //    kOSAModeDontReconnect
  854.     //    kOSAModeDoRecord
  855.     //    kOSAModeDisplayForHumans
  856.  
  857. ////////////////////////////////////////////////////////////////////////////////
  858. // OSA Optional Dialects Interface
  859. ////////////////////////////////////////////////////////////////////////////////
  860. // Scripting components that support the Dialects interface have the 
  861. // kOSASupportsDialects bit set in it's ComponentDescription.
  862. ////////////////////////////////////////////////////////////////////////////////
  863.  
  864. // These calls allows an scripting component that supports different dialects
  865. // to dynamically switch between those dialects.  Although this interface is
  866. // specified, the particular dialect codes are scripting component dependent.
  867.  
  868. pascal OSAError 
  869. OSASetCurrentDialect(ComponentInstance    scriptingComponent,
  870.                      short                dialectCode)
  871.     OSAComponentFunctionInline(kOSASelectSetCurrentDialect, 2);
  872.     //
  873.     // Errors:
  874.     //    badComponentInstance    invalid scripting component instance
  875.     //     errOSASystemError
  876.     //     paramErr:                invalid dialectCode
  877.  
  878. pascal OSAError 
  879. OSAGetCurrentDialect(ComponentInstance    scriptingComponent,
  880.                      short*                resultingDialectCode)
  881.     OSAComponentFunctionInline(kOSASelectGetCurrentDialect, 4);
  882.     //
  883.     // Errors:
  884.     //    badComponentInstance    invalid scripting component instance
  885.     //     errOSASystemError
  886.  
  887. pascal OSAError 
  888. OSAAvailableDialects(ComponentInstance    scriptingComponent,
  889.                      AEDesc*            resultingDialectInfoList)
  890.     OSAComponentFunctionInline(kOSASelectAvailableDialects, 4);
  891.     // This call return an AEList containing information about each of the
  892.     // currently available dialects of a scripting component.  Each item
  893.     // is an AERecord of typeOSADialectInfo that contains at least the fields
  894.     // keyOSADialectName, keyOSADialectCode, KeyOSADialectLangCode and 
  895.     // keyOSADialectScriptCode.
  896.     //
  897.     // Errors:
  898.     //    badComponentInstance    invalid scripting component instance
  899.     //     errOSASystemError
  900.  
  901. #define typeOSADialectInfo                'difo'
  902.     // Type of a dialect info record containing at least keyOSADialectName
  903.     // and keyOSADialectCode fields.
  904. #define keyOSADialectName                'dnam'
  905.     // Field of a typeOSADialectInfo record of typeChar.
  906. #define keyOSADialectCode                'dcod'
  907.     // Field of a typeOSADialectInfo record of typeShortInteger.
  908. #define keyOSADialectLangCode            'dlcd'
  909.     // Field of a typeOSADialectInfo record of typeShortInteger.
  910. #define keyOSADialectScriptCode            'dscd'
  911.     // Field of a typeOSADialectInfo record of typeShortInteger.
  912.  
  913. ////////////////////////////////////////////////////////////////////////////////
  914. // OSA Optional Event Handling Interface
  915. ////////////////////////////////////////////////////////////////////////////////
  916. // Scripting components that support the Event Handling interface have the 
  917. // kOSASupportsEventHandling bit set in it's ComponentDescription.
  918. ////////////////////////////////////////////////////////////////////////////////
  919.  
  920. typedef pascal OSErr (*AEHandlerProcPtr)(const AppleEvent*        theAppleEvent,
  921.                                          AppleEvent*            reply,
  922.                                          long                    refCon);
  923.  
  924. pascal OSAError
  925. OSASetResumeDispatchProc(ComponentInstance        scriptingComponent,
  926.                          AEHandlerProcPtr        resumeDispatchProc,
  927.                          long                    refCon)
  928.     OSAComponentFunctionInline(kOSASelectSetResumeDispatchProc, 8);
  929.     // This function is used to set the ResumeDispatchProc that will be used
  930.     // by OSAExecuteEvent and OSADoEvent if either no event handler can be
  931.     // found in the context, or the context event hander "continues" control
  932.     // onward. The two constants kOSAUseStandardDispatch and kOSANoDispatch
  933.     // may also be passed to this routine indicating that the handler registered
  934.     // in the application with AEInstallEventHandler should be used, or no
  935.     // dispatch should occur, respectively.
  936.     //
  937.     // Errors:
  938.     //    badComponentInstance    invalid scripting component instance
  939.     //     errOSASystemError
  940.  
  941. #define kOSAUseStandardDispatch        ((AEHandlerProcPtr)kAEUseStandardDispatch)
  942.     // Special ResumeDispatchProc constant which may be passed to 
  943.     // OSASetResumeDispatchProc indicating that the handler registered
  944.     // in the application with AEInstallEventHandler should be used.
  945.  
  946. #define kOSANoDispatch                ((AEHandlerProcPtr)kAENoDispatch)
  947.     // Special ResumeDispatchProc constant which may be passed to 
  948.     // OSASetResumeDispatchProc indicating that no dispatch should occur.
  949.  
  950. pascal OSAError
  951. OSAGetResumeDispatchProc(ComponentInstance        scriptingComponent,
  952.                          AEHandlerProcPtr*        resumeDispatchProc,
  953.                          long*                    refCon)
  954.     OSAComponentFunctionInline(kOSASelectGetResumeDispatchProc, 8);
  955.     // Returns the registered ResumeDispatchProc.  If no ResumeDispatchProc has
  956.     // been registered, then kOSAUseStandardDispatch (the default) is returned.
  957.     //
  958.     // Errors:
  959.     //    badComponentInstance    invalid scripting component instance
  960.     //     errOSASystemError
  961.  
  962. pascal OSAError
  963. OSAExecuteEvent(ComponentInstance    scriptingComponent,
  964.                 const AppleEvent*    theAppleEvent,
  965.                 OSAID                contextID,
  966.                 long                modeFlags,
  967.                 OSAID*                resultingScriptValueID)
  968.     OSAComponentFunctionInline(kOSASelectExecuteEvent, 16);
  969.     // This call is similar to OSAExecute except the initial command to
  970.     // execute comes in the form of an AppleEvent.  If the contextID
  971.     // defines any event handlers for that event, they are used to process
  972.     // the event.  If either no event handler can be found in the context, or
  973.     // the context event hander "continues" control onward, the
  974.     // ResumeDispatchProc (registered with OSASetResumeDispatchProc, above)
  975.     // is called given the AppleEvent.  The result is returned as a
  976.     // scriptValueID.
  977.     //
  978.     // Errors:
  979.     //    badComponentInstance    invalid scripting component instance
  980.     //     errOSASystemError
  981.     //     errOSAInvalidID
  982.     //     errOSAInvalidAccess:    can't modify compiledScriptID
  983.     //     errOSAScriptError:        the executing script got an error
  984.     //     errAEEventNotHandled:    attempt to continue to a nil ResumeDispatchProc
  985.     //
  986.     // ModeFlags:
  987.     //    kOSAModeNeverInteract
  988.     //    kOSAModeCanInteract
  989.     //    kOSAModeAlwaysInteract
  990.     //    kOSAModeCantSwitchLayer
  991.     //    kOSAModeDontReconnect
  992.     //    kOSAModeDoRecord
  993.  
  994. pascal OSAError
  995. OSADoEvent(ComponentInstance    scriptingComponent,
  996.            const AppleEvent*    theAppleEvent,
  997.            OSAID                contextID,
  998.            long                    modeFlags,
  999.            AppleEvent*            reply)
  1000.     OSAComponentFunctionInline(kOSASelectDoEvent, 16);
  1001.     // This call is similar to OSADoScript except the initial command to
  1002.     // execute comes in the form of an AppleEvent, and the result is an 
  1003.     // AppleEvent reply record.  If the contextID defines any event handlers
  1004.     // for that event, they are used to process the event.  If either no event
  1005.     // handler can be found in the context, or the context event hander
  1006.     // "continues" control onward, the ResumeDispatchProc (registered with
  1007.     // OSASetResumeDispatchProc, above) is called given the AppleEvent.  The
  1008.     // result is returned in the form of an AppleEvent reply descriptor. If at
  1009.     // any time the script gets an error, or if the ResumeDispatchProc returns
  1010.     // a reply event indicating an error, then the OSADoEvent call itself
  1011.     // returns an error reply (i.e. OSADoEvent should never return
  1012.     // errOSAScriptError).  Any error result returned by the ResumeDispatchProc
  1013.     // will be returned by OSADoEvent.
  1014.     //
  1015.     // Errors:
  1016.     //    badComponentInstance    invalid scripting component instance
  1017.     //     errOSASystemError
  1018.     //     errOSAInvalidID
  1019.     //     errOSAInvalidAccess:    can't modify compiledScriptID
  1020.     //     errAEEventNotHandled:    attempt to continue to a nil ResumeDispatchProc
  1021.     //
  1022.     // ModeFlags:
  1023.     //    kOSAModeNeverInteract
  1024.     //    kOSAModeCanInteract
  1025.     //    kOSAModeAlwaysInteract
  1026.     //    kOSAModeCantSwitchLayer
  1027.     //    kOSAModeDontReconnect
  1028.     //    kOSAModeDoRecord
  1029.  
  1030. pascal OSAError
  1031. OSAMakeContext(ComponentInstance    scriptingComponent,
  1032.                const AEDesc*        contextName,
  1033.                OSAID                parentContext,
  1034.                OSAID*                resultingContextID)
  1035.     OSAComponentFunctionInline(kOSASelectMakeContext, 12);
  1036.     // Makes a new empty context which may be passed to OSAExecute or 
  1037.     // OSAExecuteEvent.  If contextName is typeNull, an unnamed context is
  1038.     // created. If parentContext is kOSANullScript then the resulting context
  1039.     // does not inherit bindings from any other context.
  1040.     //
  1041.     // Errors:
  1042.     //    badComponentInstance    invalid scripting component instance
  1043.     //     errOSASystemError
  1044.     //     errOSAInvalidID
  1045.     //     errAECoercionFail:        contextName is invalid
  1046.  
  1047. ////////////////////////////////////////////////////////////////////////////////
  1048. #ifdef __cplusplus
  1049. }
  1050. #endif
  1051. // You're still here?  Go home.
  1052. #endif
  1053. ////////////////////////////////////////////////////////////////////////////////
  1054.